package aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import pojo.Book;
@Component
@Aspect
public class CharAspect {
	public CharAspect() {
		System.out.println("c....");
	}
	
	@Around("execution(* service.BookManager.addBook(..))")
	public Object toUpper(ProceedingJoinPoint point){
		System.out.println("working....");
		Object o=null;
		Book b=(Book)point.getArgs()[0];
		b.setBname(b.getBname().toUpperCase());
		try {
			o=point.proceed(new Object[]{b});
		} catch (Throwable e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return o;
	}
}
